<style lang="scss">
.plant-power{
	.serach{
		position: fixed;
		top: 1rem;
		left: 0;
		right: 0rem;
		padding: 0.35rem;
		background: #fff;
		border-bottom: 1px solid #EEEEEE;
		z-index: 115;
		.ser-back{
			border: 1px solid #EEEEEE;
			background: #f4f4f4;
			height: 0.6rem;
			line-height: 0.6rem;
			border-radius: 0.6rem;
			input{
				float: left;
				height: 0.6rem;
				line-height: 0.6rem;
				border-radius: 0.6rem;
				font-size: 0.3rem;
				color: #999;
				border: none;
				outline: none;
				width: 70%;
				text-indent: 0.25rem;
				background: transparent;
			}
			i{
				float: right;
				margin-top: 0.125rem;
				margin-right: 0.25rem;
				cursor: pointer;
				width: 0.325rem;
				height: 0.35rem;
				background: url(../../../static/img/serach-img.png) no-repeat;
				background-size: 100% 100%;
			}
		}
	}
	.power-text{
		margin-top: 2.65rem;
		z-index: 111;
		background: #fff;
		border: 1px solid #EEEEEE;
		border-left: none;
		border-right: none;
		padding: 0 0.375rem;
		li{
			height: 1.05rem;
			line-height: 1.05rem;
			border-bottom: 1px solid #EEEEEE;
		}
		li:last-child{
			border-bottom: none;
		}
		.les{
			float: left;
			font-size: 0;
			i,span{
				display: inline-block;
				vertical-align: middle;
			}
			i{
				width: 0.4rem;
				height: 0.4rem;
				background: url(../../../static/img/city-img.png) no-repeat;
				background-size: 100% 100%;
			}
			span{
				font-size: 0.4rem;
				color: #333;
				margin-left: 0.125rem;
			}
		}
		.righs{
			float: right;
			font-size: 0;
			em,span,i{
				display: inline-block;
				vertical-align: middle;
			}
			em{
				font-size: 0.45rem;
				font-family:'reducto_condensed_ssiCn';
				color: #FF8E10; 
			}
			span{
				font-size: 0.3rem;
				color: #666;
				margin-left: 0.15rem;
			}
			i{
				margin-left: 0.175rem;
				width: 0.15rem;
				height: 0.3rem;
				background: url(../../../static/img/power-downs.png) no-repeat;
				background-size: 100% 100%;
			}
		}
	}
}
</style>
<template>
<div class="plant-power">
	<headTop :theRouter="therouter"></headTop>
	<div class="serach">
		<div class="ser-back fn-clear">
			<input type="text" placeholder="请输入水电站名称进行搜索" v-model="hy_name">
			<i @click="search"></i>
		</div>
	</div>
	<ul class="power-text">
		<li class="fn-clear" v-for="(item,index) in empNumList" :key="item.id" @click="powerBtn(item)">
			<div class="les">
				<i></i>
				<span>{{item.areaName}}</span>
			</div>
			<div class="righs">
				<em>{{item.empNumber}}</em>
				<span>座</span>
				<i></i>
			</div>
		</li>
	</ul>
</div>
</template>
<script>
import { BASEURL } from './../../api/api'
import axios from 'axios'
import headTop from "./../common/header"
export default{
	name:'powerplant',
	components: { headTop },
	data(){
		return{
			areaCode:'',
			hy_name:'',
			listInfo:{
				areaCode:'',
				hyName:'',
				statu:1
			},
			empNumList:[]
		}
	},
	computed: {
	    therouter: function() {
	      return this.$route
	    }
	},
	methods:{
		init(){
			let _this = this
			_this.areaCode = window.localStorage.getItem('ORG_REGION')
			axios.get(BASEURL + 'getEmpNumByAreaCode?areaCode='+localStorage.getItem('areaCode'), {
			}).then(function (res) {
				_this.empNumList = res.data.empNumList
			}).catch(function (error) {
				console.log(error);
            })
		},
		powerBtn(item){
			let _this = this
			_this.$store.commit('saveAreaCodeDz', item.areaCode)
			_this.listInfo.statu = 2
			_this.$store.commit('saveListInfo', _this.listInfo)
			this.$router.push({ path: '/' + 'powerlists', force: true })
		},
		search(){
			let _this = this
			_this.listInfo.areaCode = localStorage.getItem('areaCode')
			_this.listInfo.hyName = _this.hy_name
			_this.$store.commit('saveListInfo', _this.listInfo)
			this.$router.push({ path: '/' + 'powerlists', force: true })
			
		},
	},
	mounted(){
		let _this = this
		_this.HyCode = this.$store.state.HyCode;
		_this.init()
	}
}
</script>